//- 找不到再往上找
extends ../commons/commons.pug

block pageStyle
	link(href='${relativePath}/static/css/personCenter/personLeft.css' type="text/css" rel="stylesheet")

block content
	div.personLeft.layout
		div.personHeader
			div.headPortBox.fl
				div.personImgBox
					img(src="")
					div.mask
						| 点击修改<br>
						| 个人资料
				div.roles
					a.supplier.current(javascript:;) 供应商
					a.buyer(javascript:;) 采购商
			//- 头部右侧
			div.headRight.fl
				h3
				div.rzList
					label.fl 认证：
					div.list.fl
						//- p 高空安装
				p.headTxt 
					| 电话：
					| <span></span>
		//- 左侧导航
		div.personLeftNav.fl
			div.navList
				ul
					li#myAttention 我的关注
					li#myOrder 我的订单
					a.first.dqr(href="dqrpersonIndex_s.html")
						| 待确认
						//- span.number 8
					a.dfk(href="dfkpersonIndex_s.html")
						| 待付款
						//- span.number 8
					a.dfh(href="dfhpersonIndex_s.html")
						| 待发货
						//- span.number 8
					a.dsh(href="dshpersonIndex_s.html")
						| 待收货
						//- span.number 8
					a.ywc.current
						| 已完成
						//- span.number.all 2306
					li#myPj 我的评价
					a.first.dpj(href="beEvaluated.html")
						|待评价
						//- span.number 8
					a.ypj(href="yEvaluated.html")
						| 已评价
						//- span.number.all 2306
					li#account 账户余额
					a(href="recharge.html").first#rechage 充值
					a(href="presentation.html")#presentation 提现
					li#msg 消息
					li#shAddress 收货地址
					li#apply 申请认证
					a.first.realRZ.current 实名认证
					a.gysRZ 供应商认证

		//- 右侧内容
		block personRight

block append pageScript

	script.
		//- 个人头像
		$.getJSON(shopIp+"/user/info?callback=?",{
			os:"web",
			userToken:token
		},function(data){
			if(data.status == 200){
				var img = data.data.avatar_img;
				var phone = data.data.phone;
				var name = data.data.nice_name;
				var category_name = data.data.category_name;
				//console.log(category_name);
				//console.log(img);
				$(".headPortBox img").attr("src",img);
				$(".headTxt span").html(phone);
				$(".headRight h3").html(name);
				if(category_name[0] == null){
					var liEle = '<p>'+'暂无'+'</p>';
					$(".rzList .list").append(liEle);
				}else{
					for(var i=0;i<category_name.length;i++) {
						var liEle = '<p>'+category_name[i]+'</p>';
						$(".rzList .list").append(liEle);
					}
				}
				
			}else{
				layer.msg(data.msg);
			}
		})

		$(".navList ul li").click(function(){
			$(this).addClass("current").siblings().removeClass("current");
		})

		$(".navList ul a").click(function() {
			$(this).addClass("current").siblings("a").removeClass("current");
		})
		//- 点击关注
		$("#myAttention").click(function(){
			window.location.href = "myAttentionList_s.html";
		})
		$(".ywc").click(function() {
			window.location.href = "ywcpersonIndex_s.html";
		})
		//- 点击我的订单
		
		$("#myOrder").click(function(){
			window.location.href = "personIndex_s.html";
		})
		//- 点击我的账户
		
		$("#account").click(function(){
			window.location.href = "account.html";
		})
		$("#msg").click(function(){
			window.location.href = "mymsg.html";
		})
		//- 点击评价
		$("#myPj").click(function() {
			window.location.href = "beEvaluated.html";
		})
		//- 点击收货地址
		
		$("#shAddress").click(function(){
			window.location.href = "receveAddress.html";
		})
		//- 点击申请认证
		$("#apply").click(function(){
			window.location.href = "application.html";
		})
		$(".realRZ").click(function() {
			window.location.href = "application.html" ;
		})
		$(".gysRZ").click(function() {
			$.post(shopIp+"/user/info",
				{
					userToken:token
				},function(data) {
					//console.log(data);
					if(data.is_identification == 0 ||data.is_identification == 3) {
						layer.msg('请先认证!');
						setTimeout(function() {
							window.location.href = "application.html" ;
						},2000);
						
					}else{
						window.location.href = "supplier.html" ;
					}
					
			})
			//window.location.href = "application.html?userToken=" + token;
		})
		//- 点击头像进个人资料
		$(".headPortBox .mask").click(function() {
			window.location.href = "personData.html";
		})
		